Skip to content

Conversation

@max-charlamb
Copy link
Member

dotnet/runtime#117785, the runtime-diagnostics pipeline has had intermittent failures due to SOS freeing the DAC/cDAC library and causing a double free race condition.

NativeAOT binaries do not support being unloaded, therefore this will be required for future cDAC use.

This change doesn't impact the native host, but in most scenarios the managed host is favored.

hoyosjs
hoyosjs previously approved these changes Oct 22, 2025
@max-charlamb max-charlamb marked this pull request as ready for review October 23, 2025 13:48
@max-charlamb max-charlamb requested a review from a team as a code owner October 23, 2025 13:48
@max-charlamb max-charlamb requested a review from hoyosjs October 23, 2025 13:49
}
if (_dacHandle != IntPtr.Zero)
{
DataTarget.PlatformFunctions.FreeLibrary(_dacHandle);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to use cDac with older versions of SOS that won't have this change?

cDAC hosted under NativeAOT could call LoadLibrary() on itself to bump the reference count up. That should prevent the OS from trying to unload it regardless whether SOS calls FreeLibrary().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants